package cn.lutu.domain.repository.impl;

import cn.lutu.dao.mapper.ArticleCollectMapper;

import cn.lutu.domain.repository.ArticleCollectRepository;
import cn.lutu.protocol.entity.Collect;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class ArticleCollectRepositoryImpl implements ArticleCollectRepository {

    @Autowired
    ArticleCollectMapper articleCollectMapper;
    @Override
    public Integer countById(Long articleId, Long userId) {
        QueryWrapper<Collect> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId).eq("article_id",articleId);
        Integer rows = articleCollectMapper.selectCount(wrapper);
        return rows;
    }
}
